1. Field of the Invention
The present invention relates to a method of motion detection, and more particularly, to a method of motion detection for a NTSC or PAL 3D comb filter video decoder.
2. Description of the Related Art
In today's modern life, it is common that people can enjoy receiving information in the comfort of home without going outside. One example is the television (TV) system, in which a TV station can transmit pictures such as the beautiful landscapes, news, dramas, movies, talk shows and other entertainment shows, which can be watched in the comfort of home. The other example is the community surveillance system, which allows monitoring the situation via displaying pictures taken by the surveillance camera on the display screen. The video systems mentioned above support different functions and objects, however, a video signal is required to be sent from a sender to a receiver in all cases.
A color is composed of the R, G, B tricolor. Therefore, in order to transmit a video picture, the sender has to convert the R, G, B color data to an electric signal before sending it out. However, since the transmission bandwidth is limited, in order to overcome transmission bandwidth limitation, a special method is used to convert the R, G, B color data into a luma and chroma data. For example, Y (luma), U (chroma), V (chroma) data is one of the examples of the luma and chroma data converted from the R, G, B data. The relationship of the R, G, B data and the Y, U, V data is Y=0.299R+0.587G+0.114B; U=0.493 (B−Y); and V=0.877 (R Y). Wherein, the weighting of the R, G, B in Y equation represents the perceptive levels of human eyes to the R, G, B tricolor. U and V represent B (blue) and R (red) in which the luma has been removed from it, respectively. As to the white light (i.e. R=G=B), its U and V are all equal to 0 (it means there is no chromatism in the white light).
When the signal is transmitted, a chroma data has to be modulated on a subcarrier first and then mixed up with a luma data. For example, in the NTSC standard defined by the National Television Standards Committee (NTSC), before the signal is transmitted, the Y, U, V data is modulated to a composite video signal as Y+U*sin(ωt)+V*cos(ωt). Wherein, ω=2π*Fsc, and Fsc is the frequency of a subcarrier signal. In addition, a Phase Alternating Line (PAL) standard is also valid as a European country TV standard, wherein the Y, U, V data is modulated with an inverse-phase line-by-line method. When the PAL standard is used to modulate the Y, U, V data in each line of the frame, the modulation method of Y+U*sin(ωt)+V*cos(ωt) or Y+U*sin(ωt)−V*cos(ωt) is interleave used. In other words, if the Y, U, V data is modulated with Y+U*sin(ωt)+V*cos(ωt) in one line, the Y, U, V data should be modulated with Y+U*sin(ωt)−V*cos(ωt) in next line.
The data in the composite video signal is sampled after the receiver receives the composite video signal. It is common that the comb filter samples the composite video signal with a frequency which is four times the Fsc, thus each line in NTSC has 910 sample points, whereas each line in PAL has 1135 sample points. Each frame in NTSC has 525 lines, thus there are total 910*525=477750 sample points. In addition, each frame in PAL has 625 lines, thus there are total 1135*625+4=709379 sample points. Since the sample points of an entire frame is not multiple of the lines, different level of the phase error is occurred on different sampling points.
In general, the most difficult part of the TV decoder technique is the Y/C separation. The effect of the Y/C separation significantly impacts the decoding quality of the AV decoder. Therefore, in the current application environment, which requires high quality image, a 3D comb filter is commonly used to perform the Y/C separation.
Before the 3D comb filtering is performed on the composite video signal, the composite video signal has to be sampled every 90 degrees of the phase angle first. As to the NTSC standard, Y+V, Y+U, Y−V, Y−U are obtained when the sample phase is equal to 0, 0.5π, π, and 1.5π, respectively. FIG. 1 is a schematic diagram illustrating the sampling result (partial) of the frames in the NTSC system. Referring to FIG. 1, the Y-axis in the diagram represents a position x of the line in the frame, and the X-axis represents a position y of the pixel in the line. If two sampling data respectively belong to their neighboring frames and are on the same corresponding position, since three are 477750 (a number of multiple of 4 adding a remainder 2) sample points in between, the phase difference between these two positions would be exactly 180 degrees. FIG. 1 also can be used to describe the sampling relationship of the neighboring frames mentioned above if the Y-axis in the diagram is modified as the sequence number m of the frame (meanwhile, the Y-axis is the time axis).
Compared to the NTSC standard, the PAL standard is a little more complicated, in that, there are 709379 (a number of multiple of 4 adding a remainder 3) sample points in a frame. Although they are all on the same corresponding position, if the sampled data of the previous frame is Y+U, the sampled data of the next frame is Y+V, and the sampled data of another next frame is Y−U. FIG. 2A is a schematic diagram illustrating the sampling result (partial) for the frames in the PAL system when the sample phase is equal to 0, 0.5π, π, and 1.5π, respectively. Referring to FIG. 2A, the Y-axis in the diagram represents a position x of the line in the frame, and the X-axis represents a position y of the pixel in the line (wherein, the Y-axis also represents the relationship of the contiguous frames). However, such arrangement makes it difficult to implement the comb filtering, thus it is common to shift the sample phase 45 degrees. In other words, the data is sampled when the sample phase is equal to 0.25π, 0.75π, 1.25π, and 1.75π, respectively. FIG. 2B is a schematic diagram illustrating the sampling result (partial) for the frames in the PAL system when the sample phase is equal to 0.25π, 0.75π, 1.25π, and 1.75π, respectively. Referring to FIG. 2B, the Y-axis in the diagram represents a position x of the line in the frame, and the X-axis represents a position y of the pixel in the line (wherein, Y-axis also represents the relationship of the contiguous frames). Wherein, A=0.707 (U+V), and B=0.707 (U−V).
During processing the PAL signal, since there are 1135*625+4 points in the PAL frame, which is not multiple of 1135, nor multiple of 625. Therefore, an error occurs when the sampling is performed based on the fact that each line has 1135 points, and 4 pixels of error are formed after the errors have been accumulated for 625 lines. Normally, these 4 pixels of error are evenly distributed on 625 lines, thus each line is shifted 4/625 pixel. Therefore, it is common that the phase of each sample point is not exactly 0.25π, 0.75π, 1.25π, and 1.75π, instead a small phase angle difference is exists. The modulation method for the PAL system is Y+U*sin(ωt)+V*cos(ωt) or Y+U*sin(ωt)−V*cos(ωt)A. It is assumed that ωt is (0.25π+δ), (0.75π+δ), (1.25π+δ), and (1.75π+δ) (where δ is a phase angle difference), then sin(0.25π+δ)=sin(0.25π)cos(δ)+cos(0.25π)sin(δ)=0.707(cosδ+sinδ)=0.707(1+e0); cos(0.25π+δ)=cos(0.25π)cos(δ)−sin(0.25π)sin(δ)=0.707(cosδ−sinδ)=0.707(1−e0); thus Y+U*sin(ωt)+V*cos(ωt)=Y+0.707(U+V+e0(U−V)=Y+A+eB, and the rest of the angles can be deduced by analogy. Finally, the physical sampling values as shown in FIG. 2C are obtained. Wherein, the phase difference eA=e0A, and the phase difference eB=e0B. FIG. 2C is a schematic diagram illustrating the physical sampling result (partial) for the frames in the PAL system when the sample phase is equal to 0.25π+δ, 0.75π+δ, 1.25π+δ, and 1.75π+δ, respectively. Referring to FIG. 2C, the Y-axis in the diagram represents a position x of the line in the frame, and the X-axis represents a position y of the pixel in the line (wherein, the Y-axis also represents the relationship of the contiguous frames).
FIG. 3A is a schematic block diagram of a conventional 3D comb filter. Referring to FIG. 3A, a 3D comb filter generally comprises an inter-frame Y/C separator 310, an intra-field Y/C separator (i.e. the so-called 2D comb filter) 320, a motion detector 330, a memory 340, and a mixer 350. The composite video signal 301 is a sampled signal, and Fm+1 indicates that the composite video signal 301 is a composite video signal of the (m+1)th frame. The memory 340 temporarily stores the composite video signal 301, and provides a composite video signal 302 and a composite video signal 305 (wherein, Fm represents the composite video signal of the mth frame). The intra-field Y/C separator 320 receives the composite video signal 305 and performs the Y/C separation according to the space correlation among the pixels in the frame Fm, and finally outputs a separated video signal 321.
In general, the Y/C separation of a motion video signal is performed by the intra-field Y/C separator 320. However, the intra-field Y/C separator is disadvantageous in that an edge blur is generated when processing a still video signal. In order to improve the picture quality, the still video signal is commonly processed by the inter-frame Y/C separator 310. A conventional inter-frame Y/C separator 310 receives the composite video signals of the frame Fm+1 and frame Fm simultaneously, and performs the Y/C separation according to the time correlation among the pixels each corresponding to the contiguous frame Fm+1 and frame Fm, respectively, so as to output a separated video signal 311. The motion detector 330 is responsible for determining whether the composite video signal 301 is a motion video signal or a still video signal. A conventional motion detector 330 first receives the composite video signal 301 and a luma data 321a (which is provided by the separated video signal 321), then uses the luma data 321a and the composite video signal 301 to calculate a luma difference and a chroma difference for the two frames, then determines a motion/still status of the pixel according to the luma difference and the chroma difference, and finally outputs a selection signal 331. The mixer 350 selects the separated video signal 321 or the separated video signal 311, or mixed them up with a predetermined ratio according to the selection signal 331, and outputs a separated video signal 351.
The motion detector 330 is a key component of the 3D comb filter. If the motion status is falsely determined as the still status, an obvious error picture is formed accordingly. If it is too conservative such that most of the cases are determined as the motion status, the 3D effect is significantly impacted. The method of motion detection in the prior art calculates the Y/C (luma/chroma) value of the previous frame and the current frame, respectively, and compares the difference between these two values. FIG. 3B is a schematic block diagram of a motion detector of a conventional 3D comb filter. Referring to FIG. 3B, as to the NTSC standard, an approximate luma data 332 is obtained after the composite video signal 301 has passed through a low pass filter (LPF) 360, and a luma data 333 of the previous frame is obtained after the approximate luma data 332 has been delayed by a frame buffer 391 for a frame time. The luma data 332 of the current frame is then compared with the luma data 333 of the previous frame so as to obtain a luma difference 334. In addition, a chroma data 336 is obtained after the composite video signal 301 has passed through a band pass filter (BPF) 370 and has been subtracted from the luma data 321a (which is provided from the separated video signal 321 calculated by the intra-field Y/C separator 320). Then, the chroma data 338 of the previous two frames is obtained after the chroma data 336 has been delayed by the frame buffers 392, 393 for two frames time. A chroma difference 339 is obtained after the chroma data 336 of the current frame is subtracted from the chroma data 338 of the previous two frames. A detecting circuit 380 calculates a motion factor by selecting a number which is bigger between the luma difference 334 and the chroma difference 339.
As to the PAL standard, the method of motion detection in the prior art is similar to the one in the NTSC standard except for the frame buffers 392, 393 delay the chroma data 336 for 4 frames time, and therefore detail description of other similar elements is omitted herein.
It is common to compare the motion factor with a predetermined threshold in determining the motion/still status of the composite video signal 301. If the motion factor is obviously greater than the threshold, it is determined as in the motion status, and meanwhile the detecting circuit 380 outputs a selection signal 331 to select the intra-field Y/C separator 320. If the motion factor is obviously smaller than the threshold, it is determined as in still status, and meanwhile the detecting circuit 380 outputs a selection signal 331 to select the inter-frame Y/C separator 310 for improving the picture quality. If the motion factor is near to the threshold, it is difficult to roughly determine whether it is in motion status or in still status. Therefore, it is common to mix up the Y/C data, which are obtained from the calculation of the intra-field Y/C separator 320 and the inter-frame Y/C separator 310 respectively, with an appropriate ratio for processing this kind of grey-area case. Therefore, the greater the non-convergence of the method for calculating the motion factor, the greater the range of the grey-area, the less the advantages of the 3D comb filter.
The method of motion detection of the prior art, a Y/C data is first calculated using the intra-field Y/C separation method and compares it with a Y/C data of the previous frame, and then determines a final Y/C data which is output according to the comparison result. Therefore, a chicken-egg problem occurs. If the intra-field Y/C separation can accurately separate the Y/C data in the beginning stage, the inter-frame Y/C separation is not required, and there is no need to calculate the motion factor. However, if the Y/C data calculated in the beginning stage is not correct, the motion factor, which is calculated based on the incorrect Y/C data is not correct, either. Therefore, its correctness is greatly impacted if the final Y/C data is determined based on an incorrect motion factor.